Figure 26.3 shows the form with the text boxes in place.
Figure 26.3
Use unbound controls in conjunction with Data
Access Objects to display data in a database.
4. Create the following user-defined sub procedure in frmDAOTest's Code window:
Sub ShowFields()
TxtTitle.Text = rsTitles!Title
TxtISBN.Text = rsTitles!ISBN
TxtYear.Text = rsTitles![Year Published]
End Sub
5. Add the following lines of code to the end of the form's Load event procedure:
rsTitles.MoveFirst
Call ShowFields
Because the Text property is the default property of a text box, you do not have to include the property name in the assignment statement. My personal preference is to include the name for readability.
Positioning the Record Pointer
Because a database with only one record is fairly useless, a database engine must provide ways to move from one record to another within recordsets. Visual Basic provides six such techniques:
Technique
Description
Move methods
Changes the position of the record pointer from the current record to another record.
Find methods
Locates the next record that meets the find condition. Find methods work on dynasets and snapshots.
Seek method
Finds the first record in a table that meets the requested condition.